#ifndef _SPHERE
#define _SPHERE

// INCLUDES --------------------------------------------------------------------
#include "Base.h"
#include "Vector4.h"
#include "Ray.h"

// DEFINES ---------------------------------------------------------------------

// TYPEDEFS --------------------------------------------------------------------
typedef struct
{
  Vector4 c;   // center
  fp radius, // sphere radius
     zNear,  // nearest hit distance (for ray intersection)
     zFar;   // farthest hit distance (")
} Sphere;

// FUNCTIONS -------------------------------------------------------------------

/* GENERAL:
   d    -> destination
   s    -> source
   size -> array size (0,1 for single elements)

   s    -> arbitrary sphere
   r    -> arbitrary ray
*/
void SphereClear    (Sphere *s, ui32 size);            // clear to c:[0,0,0,1], radius: 1.0f, hit distances: 0.0f
void SphereCopy     (Sphere *d, Sphere *s, ui32 size); // clone sphere src->dest

void SphereIntersect(Sphere *s, Ray *r, ui32 size);    // compute intersection

#endif // _SPHERE
